package com.example.weibo_app.service.impl;

import com.example.weibo_app.domain.User;
import com.example.weibo_app.mapper.UserMapper;
import com.example.weibo_app.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper mapper;

    @Override
    public List<User> selectAll() {
        return mapper.selectAll();
    }

    @Override
    public User selectById(int id) {
        return mapper.selectById(id);
    }

    @Override
    public int SaveUser(User user) {
        return mapper.SaveUser(user);
    }

    @Override
    public int UpdateUser(User user) {
        return mapper.UpdateUser(user);
    }

    @Override
    public int DeleteUser(int id) {
        return mapper.DeleteUser(id);
    }

    @Override
    public String checkUser(User user) {
        boolean res = mapper.checkUser(user);
        if (res) {
            return "登录成功";
        } else {
            return "用户名或密码错误";
        }
    }
}